# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=kind
pkgver=0.20.0
pkgrel=5
pkgdesc="Kubernetes IN Docker - local clusters for testing Kubernetes"
url="https://kind.sigs.k8s.io/"
license="Apache-2.0"
arch="all"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/kubernetes-sigs/kind/archive/v$pkgver/kind-$pkgver.tar.gz
	skip-version-test.patch
	"

export CGO_ENABLED=0
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build

	./kind completion bash > $pkgname.bash
	./kind completion fish > $pkgname.fish
	./kind completion zsh > $pkgname.zsh
}

check() {
	go test -tags=nointegration ./...
}

package() {
	install -Dm755 $pkgname -t "$pkgdir"/usr/bin/

	install -Dm644 $pkgname.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 $pkgname.fish "$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -Dm644 $pkgname.zsh "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
9672853ad65b101e9d0d179e5c3e710ff1a6fbb94e36dfc2b84f88992e349813334c3b9a661bf99a276509ec24cb1b1ee3ba3041f701e75d0e5d37121ea2a74a  kind-0.20.0.tar.gz
6993628a0a5c938b0e59b92e04b32bd7d454dc4ee7e5c445c4122dacdb786d0372836c59749c767f5921b9ac96b4452c5d696c2c7d701ea8e10ac256d6d7d67c  skip-version-test.patch
"
